/**
 * @ProjectName:岱嘉医生健康管理门户软件
 * @Copyright: 2014 ShangHai DJ HealthUnion Systems Co., Ltd. All Right Reserved.
 * @address: http://www.djhealthunion.com/
 * @date: 2014-12-09 下午1:47
 * @Description:
 */
package com.mida.dms.knw.util;

import com.mida.dms.knw.entity.vo.DtModelPropertyVo;

import java.util.Comparator;


/**
 * DtModelPsotionComparator
 * @author dj
 */
public class DtModelPsotionComparator implements Comparator {

	/**
	 * 位置比较
	 * @param o1
	 * @param o2
	 * @return
	 */
	@Override
	public int compare(Object o1, Object o2) {
		DtModelPropertyVo d1 = (DtModelPropertyVo) o1;
		DtModelPropertyVo d2 = (DtModelPropertyVo) o2;
		if(d1.getPsotion()!=null && d2.getPsotion()!=null) {
			Long temp1 = d1.getPsotion();
			Long temp2 = d2.getPsotion();
			if(temp1.compareTo(temp2)>0){
				return -1;
			}else if(temp1.compareTo(temp2)<0){
				return 1;
			}else {
				return 0;
			}
		}else if(d1.getPsotion()!=null){
			return 1;
		}else if(d2.getPsotion()!=null){
			return -1;
		}else {
			return 0;
		}
	}

}
